<template>
  <view class="">

  </view>
</template>

<script>
  export default {
    data() {
      return {

      }
    },
    onLoad() {
      let userName = uni.getStorageSync('userInfo').nickName || '其他未登录用户';
      this.$uniCloud('addlog', {
        type: 'add',
        name: userName,
        type_user: 'visit_copy'
      })
      var pasArr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
        'u',
        'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
        'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_', '-', '$',
        '%', '&', '@', '+', '!'
      ];
      var password = '';

      var pasArrLen = pasArr.length;
      for (var i = 0; i < 16; i++) {
        var x = Math.floor(Math.random() * pasArrLen);
        password += pasArr[x];
      }
      const that = this
      uni.showModal({
        title: '提示',
        content: password,
        success() {
          uni.setClipboardData({
            data: password,
            success: function() {
              setTimeout(() => {
                that.back()
              }, 300)
              console.log('success');
            }
          });
        }
      })

    }
  }
</script>

<style>
</style>
